<?php

class OpinionsController extends AppController {
    
    public $layout = "admin";

    public $sl_opiniones = array(
        "actions" => array("V" => "view", "E" => "edit", "D" => "delete"),
        "filters" => array(
            array('name' => 'Opinion.titulo', 'label' => 'Título'),
            array('name' => 'Opinion.fecha', 'label' => 'Fecha', 'presentation' => 'DATE'),
            array('name' => 'Opinion.autor', 'label' => 'Autor')
        ),
        "columns" => array(
            array('name' => 'Opinion.id', 'label' => 'Número'),
            array('name' => 'Opinion.fecha', 'label' => 'Fecha', 'presentation' => 'DATE'),
            array('name' => 'Opinion.autor', 'label' => 'Autor')
        )
    );
    public $maint_opiniones = array(
        "fields" => array(
            "Descripción del Opinión" =>
            array(
                array("name" => "fecha", "label" => 'Fecha', 'presentation' => 'DATETIME', 'classparams' => '{"force":true}', 'isvisible' => false, "actions" => "A"),
                array('name' => 'fecha', 'label' => 'Fecha', 'presentation' => 'DATE', 'actions' => 'E|V', 'readonly' => true),
                array("name" => 'autor', "label" => 'Autor'),
                array("name" => 'titulo', "label" => 'Título', 'size' => '78'),
                array("name" => 'cuerpo', "label" => 'Cuerpo', 'presentation' => 'TEXTAREA'),
                array("name" => 'imagen', "label" => 'Imagen', 'presentation' => 'FILE')
            )
        )
    );

    public function add() {
        $this->maint = $this->maint_opiniones;
        parent::add();
    }

    public function edit($id = null) {
        $this->maint = $this->maint_opiniones;
        parent::edit($id);
    }

    public function index() {
        $this->search_list = $this->sl_opiniones;
        parent::index();
    }

    public function view($id = null) {
        $this->maint = $this->maint_opiniones;
        parent::view($id);
    }

}